﻿using XiaTiNode.Core.Interface;
using XiaTiNode.Core.Type;
using Zack.DomainCommons.Models;

namespace FaceService.Domain.Entities;

public record Face : BaseEntity, IHasDeleted
{
    public StatusType Status { get; private set; }

    /// <summary>
    /// 人像
    /// </summary>
    public string Image { get; private set; } = default!;

    /// <summary>
    /// 姓名
    /// </summary>
    public string Name { get; private set; } = default!;

    /// <summary>
    /// 学号
    /// </summary>
    public string StudentId { get; private set; } = default!;

    /// <summary>
    /// 人脸特征值
    /// </summary>
    public List<float> FaceExtract { get; private set; } = default!;

    public static Face Created(Guid id, string name, string image, string studentId, List<float> faceExtract)
    {
        Face face = new()
        {
            Id = id,
            Status = StatusType.Default,
            Name = name,
            Image = image,
            StudentId = studentId,
            FaceExtract = faceExtract,
        };

        return face;
    }

    public void Deleted()
    {
        Status = StatusType.Deleted;
    }

    public void ChangeName(string name)
    {
        Name = name;
    }

    public void ChangeImage(string image)
    {
        Image = image;
    }

    public void ChangeFaceExtract(List<float> faceExtract)
    {
        FaceExtract = faceExtract;
    }

    public void ChangeStudentId(string studentId)
    {
        StudentId = studentId;
    }
}